<div class="collapse collapse-plus bg-base-200 overflow-visible">
  <input type="checkbox">
  <div class="collapse-title text-xl font-medium">
    <div>
      Form Completed Email
    </div>
  </div>
  <div class="collapse-content">
    <%= form_for AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::SUBMITTER_COMPLETED_EMAIL_KEY), url: settings_personalization_path, method: :post, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
      <%= f.hidden_field :key %>
      <%= f.fields_for :value, Struct.new(:subject, :body, :attach_audit_log).new(*f.object.value.values_at('subject', 'body', 'attach_audit_log')) do |ff| %>
        <div class="form-control">
          <div class="flex items-center">
            <%= ff.label :subject, class: 'label' %>
            <span class="tooltip" data-tip="Use following placeholders text: <%= AccountConfig::DEFAULT_VALUES.dig(AccountConfig::SUBMITTER_COMPLETED_EMAIL_KEY, 'subject').scan(/{{.*?}}/).join(', ') %>">
              <%= svg_icon('info_circle', class: 'w-4 h-4') %>
            </span>
          </div>
          <%= ff.text_field :subject, required: true, class: 'base-input', dir: 'auto' %>
        </div>
        <div class="form-control">
          <div class="flex items-center">
            <%= ff.label :body, class: 'label' %>
            <span class="tooltip" data-tip="Use following placeholders text: <%= AccountConfig::DEFAULT_VALUES.dig(AccountConfig::SUBMITTER_COMPLETED_EMAIL_KEY, 'body').scan(/{{.*?}}/).join(', ') %>">
              <%= svg_icon('info_circle', class: 'w-4 h-4') %>
            </span>
          </div>
          <autoresize-textarea>
            <%= ff.text_area :body, required: true, class: 'base-input w-full py-2', dir: 'auto' %>
          </autoresize-textarea>
        </div>
        <div class="flex items-center justify-between py-2.5 mx-1">
          <span>
            Attach audit log PDF
          </span>
          <%= ff.check_box :attach_audit_log, { checked: ff.object.attach_audit_log != false, class: 'toggle' }, 'true', 'false' %>
        </div>
      <% end %>
      <div class="form-control pt-2">
        <%= f.button button_title(title: 'Save', disabled_with: 'Saving'), class: 'base-button' %>
      </div>
    <% end %>
  </div>
</div>
